using System;
using System.Collections.Generic;
using System.Web.UI;
using System.Web.UI.WebControls;
using DotNetNuke.Modules.NBrightEspace.Components;
using DotNetNuke.Services.Exceptions;
using NBrightCore.common;
using NBrightCore.render;

namespace DotNetNuke.Modules.NBrightEspace
{

    /// -----------------------------------------------------------------------------
    /// <summary>
    /// The EditNBrightEspace class is used to manage content
    /// </summary>
    /// -----------------------------------------------------------------------------
    public partial class ArticleSel : EspaceModuleBase
    {

        #region Event Handlers

        private const string EntityTypeCode = "ARTICLES"; // change for DB records
        private const string CtrlTypeCode = "ARTICLESEL"; // change for Ctrl


        override protected void OnInit(EventArgs e)
        {
            //Set base EntityTypeCode, MUST be done for all NBright child ctrls before OnInit
            base.EntityTypeCode = EntityTypeCode;
            base.CtrlTypeCode = CtrlTypeCode;
            
            base.OnInit(e);
            
            //initalize the repeater template based on what we want to see, a list or editing details.
            base.OnInitActivateList(true, true, MapPath(ControlPath));

        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (Page.IsPostBack == false)
            {
                PageLoad();
            }
        }

        private void PageLoad()
        {
            try
            {
                base.HideMenu();
                base.HideBanner();
                base.BindListData();
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }



        #endregion


    }

}